package cn.net.gexing.web;

import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.mvc.SimpleFormController;

import cn.net.gexing.model.Article;
import cn.net.gexing.service.PersonBiz;


public class InsertPersonControl extends SimpleFormController {

	private PersonBiz personBiz;
	
	private String viewPage;
	
	
	public String getViewPage() {
		return viewPage;
	}


	public void setViewPage(String viewPage) {
		this.viewPage = viewPage;
	}


	public void setPersonBiz(PersonBiz personBiz) {
		this.personBiz = personBiz;
	}


	protected ModelAndView onSubmit(Object command) throws Exception {
		Article p=(Article)command;
		boolean flag=personBiz.addPerson(p);
		if(flag){
			return new ModelAndView(this.getViewPage(),"flag","insertSuccess");
		}else{
			return new ModelAndView(this.getViewPage(),"flag","insertFail");
		}
		
	}

	
}
